Repository navigation
Conversation
…d refuse only the queries keyed by it (#420)
sinha108
marked this pull request as draft
November 23, 2026 14:37
…420) - A callable's file is indexed by its id, not its owner's name, so locate, resolve_callable and the queries built on them work for every uncontested callable, and for positions in either copy's file. - A key two copies spell refuses as a lookup and is an ambiguity to resolve_callable; each copy answers to "<key>@<file>", and the call graph and get_callables_overview use that spelling, so copies are no longer merged into one node. - Filtered, name-keyed answers refuse only when a contested name is in them; file-carrying lists include every copy; get_all_classes still refuses. - New get_class_declarations(name): every declaration, by file.
…name (#420) - get_all_callers/get_all_callees refuse a contested (class, signature), naming both files, instead of answering {}; "<signature>@<file>" asks about one copy. get_class_call_graph refuses a contested class instead of merging its copies' edges. - The symbol-table call graph resolves an implicit receiver against the owner's own copy and does not follow a contested receiver or supertype, so uncontested questions answer as before; its nodes use the addressing keys. - get_variables and get_test_methods key each callable, so they no longer refuse; get_all_entry_point_methods refuses only when a contested class declares an entry point.
sinha108
marked this pull request as ready for review
November 23, 2026 15:35
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #420.
An application whose types share a qualified name (vendored copies of one library across services) could not be loaded.
JCodeanalyzerraisedduplicate_type_namefrom_index()at construction, andJNeo4jBackendraised it lazily on first use. This PR follows the issue's proposal: load always, and refuse only the queries a contested name makes ambiguous.Loading
index_types, inanalysis/java/backend.py, is called by both backends, so they behave the same and refuse at the same point.NameIndexmaps a name to its declarations and their files. Callables stay keyed by theircan://id, which is unique per copy, and each callable's file is indexed by that id, never by its owner's name, which the copies share.Types
get_class,get_java_fileand the like raiseCodeanalyzerExecutionException, naming the competing files. The message says the name is declared in more than one file; it no longer blames the analyzer.get_all_sub_classes,get_all_entry_point_classes, the per-kind accessors) refuse only when a contested name would be one of their keys.get_entrypoint_classes,get_all_commentsover Neo4j) list every copy.get_all_classes()still refuses, since every name is one of its keys.get_class_declarations(name), on the backends and the facade: every declaration of a name, by file. Empty when nothing declares it; never raises.Callables
locate,resolve_callable,get_source, the CRUD and taint queries.locatealso works in either copy's file.<fqn>.<signature>) names neither. Each copy answers to<fqn>.<signature>@<file>:resolve_callableraisesAmbiguousName, listing that spelling for each copy. Either the spelling orin_module=resolves it.get_source, raises with both files.get_callables_overview()lists each copy under its@<file>key.<fqn>.<signature>@<file>, each with its own edges. Before, they were merged into one node silently. Uncontested node keys don't change.Call-graph queries
get_all_callers/get_all_calleeson a contested(class, signature)refuse, naming both files, instead of answering{}."<signature>@<file>"asks about one copy.get_class_call_graphon a contested class refuses instead of merging both copies' edges.Other whole-application answers
get_variablesandJavaAnalysis.get_test_methodsare keyed per callable, so they no longer refuse; each copy of a contested key is<key>@<file>.get_all_entry_point_methodsrefuses only when a contested class declares an entry point.get_all_methods_in_application,get_methodsandget_class_hierarchyare keyed by every class name, so likeget_all_classes()they refuse.Existing public signatures don't change (
get_class_declarationsis the one addition), andindex[name] = valueanddel index[name]still work for code that writes into_types.Sequencing. As the issue asks, this lands with or behind codellm-devkit/codeanalyzer-java#279 (for #269). That PR binds each caller to its own copy and reports duplicates, so loading these analyses no longer means answering with wrong-copy edges.
Tests, each over both backends unless noted, on daytrader8 plus a vendored copy of one unit:
locateandresolve_callableanswer, andlocateworks in the copy's file;@<file>spelling andin_module=resolve it,get_sourcerefuses the bare key, and the overview lists both copies;get_class_declarations, on both backends and the facade, andget_test_methodsthrough the facade (the in-memory backend);NameIndexassignment and deletion, as a unit test.Full suite: 2,055 passed. The only failure is
test_c_modules_are_gone. In my checkout a stale, git-ignoredcldk/analysis/c/directory (caches only) imports as a namespace package; it is unrelated to this change.